home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / libiberty / Makefile.dos < prev    next >
Encoding:
Makefile  |  1992-02-22  |  3.9 KB  |  150 lines

  1. #
  2. # Makefile for libiberty directory
  3. #
  4.  
  5. srcdir = .
  6.  
  7. TARGETLIB = libiberty.a
  8. RANLIB = ar rvs
  9. AR = ar
  10. AR_FLAGS = crv
  11. MINUS_G = -O
  12. CFLAGS = $(MINUS_G) -I. -I$(srcdir)/../include $(HDEFINES)
  13.  
  14. # NEEDED_OBJECTS is overridden by config/mh-default,
  15. # and also the recursive make in the rule for $(TARGETLIB).
  16. NEEDED_OBJECTS=getcwd.o msdos.o
  17.  
  18.  
  19. # The default target just invokes make recursively.
  20. # However, the automatic configuration (in config/mh_default).
  21. # first causes it to figure out the objects missing in libc.
  22. all:    $(TARGETLIB)
  23. all-info:
  24. install-info:
  25.  
  26. #### Host and target-dependent makefile fragments come in here.
  27. HDEFINES=-D__MSDOS__ -D__GO32__
  28. ### End of host and target-dependent makefile fragments.
  29.  
  30. srcdir = .
  31. ddestdir = /usr/local
  32.  
  33. libdir = $(ddestdir)/lib
  34.  
  35. # NOTE: If you add new files to the library, edit 'functions.def'.
  36. CFILES = basename.c bcmp.c bcopy.c bzero.c getopt.c getopt1.c getpagesize.c \
  37.     getcwd.c index.c insque.c obstack.c rindex.c spaces.c strdup.c \
  38.     strerror.c strstr.c strtol.c strtoul.c vfork.c \
  39.     vfprintf.c vprintf.c vsprintf.c sigsetmask.c concat.c
  40. # These are always included in the library.
  41. REQUIRED_OFILES = basename.o spaces.o concat.o getopt.o getopt1.o obstack.o fdmatch.o argv.o
  42. OPTIONAL_OFILES = bcmp.o bcopy.o bzero.o getpagesize.o \
  43.     getcwd.o index.o insque.o rindex.o strdup.o \
  44.     strerror.o strstr.o strtol.o strtoul.o vfork.o \
  45.     vfprintf.o vprintf.o vsprintf.o  sigsetmask.o
  46.  
  47. # Do we want/need any config overrides?
  48. #     
  49.  
  50. STAGESTUFF = $(TARGETLIB) *.o
  51.  
  52. install: all
  53.     cp $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  54.     $(RANLIB) $(libdir)/$(TARGETLIB).n
  55.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  56.  
  57. # The default configuration adds to libiberty all those functions that are
  58. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  59. # Then a sed+awk combination translates the ld error messages into
  60. # a list of .o files.
  61.  
  62. needed-list: $(srcdir)/dummy.c $(EXTRA_OFILES) needed.awk
  63.     -($(CC) $(CFLAGS) $(LDFLAGS) $(srcdir)/dummy.c $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  64.     awk -f needed.awk <errors >needed-list
  65.     -rm -f a.out errors dummy.o
  66.  
  67. # Generate an awk script that looks for functions in functions.def
  68.  
  69. needed.awk: $(srcdir)/functions.def
  70.     echo "#*** Automatically generated from $(srcdir)/functions.def"\
  71.       "- DO NOT EDIT ***" >needed.awk
  72.     grep '^DEF(' < $(srcdir)/functions.def \
  73.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf \" \1\.o" }|' \
  74.         >>needed.awk
  75.  
  76. RULE1 = not-used
  77. $(RULE1): $(REQUIRED_OFILES) $(HOST_OFILES)
  78.     $(MAKE) RULE1=not-needed RULE2=$(TARGETLIB) \
  79.          NEEDED_OBJECTS="$(NEEDED_OBJECTS)"\
  80.         "CC=$(CC)" "CFLAGS=$(CFLAGS)" \
  81.         "AR=$(AR)" "AR_FLAGS=$(AR_FLAGS)" "RANLIB=$(RANLIB)"
  82.  
  83. # Rule invoked by recursive make in $(RULE1).
  84. RULE2 = $(TARGETLIB)
  85. $(RULE2): $(REQUIRED_OFILES) $(NEEDED_OBJECTS) $(EXTRA_OFILES)
  86.     -rm -rf $(TARGETLIB)
  87.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  88.       $(REQUIRED_OFILES) $(NEEDED_OBJECTS) $(EXTRA_OFILES)
  89.     $(RANLIB) $(TARGETLIB)
  90.  
  91. .always.:
  92. # Do nothing.
  93.  
  94. .PHONEY: all etags tags ls clean stage1 stage2 .always.
  95.  
  96. stage1: force
  97.     - mkdir stage1
  98.     - mv -f $(STAGESTUFF) stage1
  99.  
  100. stage2: force
  101.     - mkdir stage2
  102.     - mv -f $(STAGESTUFF) stage2
  103.  
  104. stage3: force
  105.     - mkdir stage3
  106.     - mv -f $(STAGESTUFF) stage3
  107.  
  108. stage4: force
  109.     - mkdir stage4
  110.     - mv -f $(STAGESTUFF) stage4
  111.  
  112. against=stage2
  113.  
  114. comparison: force
  115.     for i in *.o ; do cmp $$i $(against)/$$i || exit 1 ; done
  116.  
  117. de-stage1: force
  118.     - (cd stage1 ; mv -f * ..)
  119.     - rmdir stage1
  120.  
  121. de-stage2: force
  122.     - (cd stage2 ; mv -f * ..)
  123.     - rmdir stage2
  124.  
  125. de-stage3: force
  126.     - (cd stage3 ; mv -f * ..)
  127.     - rmdir stage3
  128.  
  129. de-stage4: force
  130.     - (cd stage4 ; mv -f * ..)
  131.     - rmdir stage4
  132.  
  133. etags tags: TAGS
  134.  
  135. TAGS: $(CFILES)
  136.     etags $(HFILES) $(CFILES)
  137.  
  138. ls:
  139.     @echo Makefile $(HFILES) $(CFILES)
  140.  
  141. # Need to deal with profiled libraries, too.
  142.  
  143. clean:
  144.     rm -f *.a *.o core errs *~ \#* TAGS *.E a.out needed.awk errors needed-list
  145.  
  146. force:
  147.  
  148. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  149.     $(SHELL) ./config.status
  150.